﻿
namespace MementoPattern;

/// <summary>
/// 一个类，需要保存其在不同时期的不同状态
/// </summary>
internal class War3
{
    public string? Name { get; set; }
    public string? Hero { get; set; }
    public string? Army { get; set; }
    public string? Resource { get; set; }

    public void Show()
    {
        Console.WriteLine($"{Name} {Hero} {Army} {Resource}");
    }

    public void Save(string name)
    {
        War3Memnto war3Memnto = new War3Memnto(Hero,Army,Resource);
        //CareTake.Save(war3Memnto);
        CareTake.Save(name,war3Memnto);
    }

    public void Load(string name)
    {
        var res = CareTake.Get(name);
        this.Army = res.Army;
        this.Resource = res.Resource;
        this.Hero = res.Hero;
    }
}
